package emulator.hardware.clock;

public class BarrierClockHandle implements ClockHandle
{
	private BarrierClock _clock;
	private int _id;
	private int _ticks;
	
	public BarrierClockHandle(BarrierClock clock, int id)
	{
		_clock = clock;
		_id = id;
		_ticks = 0;
	}
	
	@Override
	public void tick()
	{
		try {
			_clock.tick(_id);
			_ticks++;
		} catch (Exception ex) {
		}
	}

	@Override
	public void tick(int x)
	{
		for (int i = 0; i < x; i++)
			tick();
	}

	@Override
	public long getTicks()
	{
		return _ticks;
	}

}
